<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>登录</title>
		<link rel="stylesheet" type="text/css" href="css/base2.css" />
		<link rel="stylesheet" type="text/css" href="css/login2.css" />
	</head>

	<body style="background:#E8E8E8;">
		<img class="logo" src="images/zgjzlogo.png" />
		<div class="slogan ">中國建業</div>
		<input class="input1" type="text" id="account" placeholder="请输入账户" />
		<input class="input2" type="password" id="password" placeholder="请输入密码" />
		<!--<input class="log" id="btnLogin" type="button" value="登录 " />-->
		<button id='btnLogin' class="log">登 录</button>
		<!--<div class="forget">
			<a href="#" id="reg" style="float: left;color: #1477f2;">立即注册</a> 
			<a href="#" id="findPwd" style="float: right;">忘记密码?</a>
		</div>-->
		<div class="log_bg">

		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/wf.js"></script>
		<script src="js/zepto.min.js"></script>
		<script type="text/javascript">
		(function(doc) {
				mui.init();
		mui.plusReady(function() {
			plus.nativeUI.closeWaiting();
			$("#account").val(localStorage.getItem("account") ? localStorage.getItem("account") : "");
			$("#password").val(localStorage.getItem("password") ? localStorage.getItem("password") : "");		
			$("#btnLogin").on("tap",function(){
				if ($("#account").val() == "") {
					event.detail.gesture.preventDefault(); //阻止默认事件
					mui.toast("用户名不能为空");
					mui.focus($("#account"));
					return;
				}
				if ($("#password").val() == "") {
					event.detail.gesture.preventDefault();
					mui.toast("密码不能为空");
					mui.focus($("#password"));
					return;
				}
				
				var datas = new Object();
				datas.UserName = $("#account").val();
				datas.password = $("#password").val();
//				if (plus.os.name == "Android"){
//				datas.clientId = plus.device.imei;//plus.push.getClientInfo().clientid;
//				}else{
//				  datas.clientId = plus.device.uuid;
//				}
//				datas.clientType = 1;
//				console.log(datas.clientId);
				wf.ajax("Account/UnEncryptLogin",{//?UserName=datas.UserName&Password=datas.password
					data:datas,
					type: "get",
					dataType:"json",
					success:function(resule){
						if (resule.Code == "20000") {
							
							//记住密码
							localStorage.setItem("account",  $("#account").val());
							localStorage.setItem("password", $("#password").val());
							localStorage.setItem("userId",resule.Data.UserID);
							//保存返回的数据到本地
//							localStorage.setItem("userId", resule.data.userId);
//							localStorage.setItem("userName", resule.data.userName);
//							localStorage.setItem("realName", resule.data.realName);
//							localStorage.setItem("token", resule.data.token);
							//创建预加载页面
//							getTemplate('temp1','Temp.html');
//							getTemplate('temp2','Temp.html');
							//跳转到首页
							//tiza.openTemp(1,"","index.html");
							//跳转到首页
							//var obj=JSON.parse(resule.Data);	
							
							mui.openWindow({					
//								url: 'project/projectlist.html',
//								id: 'projectlist',
//								 extras:{
//     		 						username:resule.Data.UserName,
//      							userid:resule.Data.UserID,
//      							value:resule.Data.PermissionList
//  							}
								url: 'main.html',
								id: 'main',
								extras:{
       		 						username:resule.Data.UserName,
        							userid:resule.Data.UserID,
        							value:resule.Data.PermissionList
    							}
							});
						}else{
							plus.nativeUI.closeWaiting();
							mui.toast(resule.msg);
						}
					}
				});
			});
		});
	}(document));
		</script>
			
	</body>

</html>